<template>
  <div class="panel-section">
    <h3 class="section-title">
      <i class="fas fa-question-circle"></i>热点问题
    </h3>
    <ul class="faq-list">
      <li v-for="item in questionList" :key="item.id" @click="questionHandler(item)">{{ item.name }}</li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'QuestionList',
  data() {
    return {
      questionList: [
        {
          id: 1,
          name: '什么是人工智能？',
          value: '什么是人工智能？'
        }, {
          id: 2,
          name: '如何学习编程？',
          value: '如何学习编程？'
        }, {
          id: 3,
          name: '天气查询',
          value: '今天天气怎么样？'
        }, {
          id: 4,
          name: '健康咨询',
          value: '健康生活小常识'
        }, {
          id: 5,
          name: '技术问题',
          value: '如何解决技术问题？'
        }
      ]
    }
  },
  methods: {
    /**
     * 热点问题被点击
     * @param item 
     */
    questionHandler(item) {
      this.$emit('askByReference', item.value)
    }
  }
};
</script>

<style lang="less" scoped>
.panel-section {
  margin-bottom: 30px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e6e6e6;
}

.section-title i {
  color: #2196f3;
}

.faq-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.faq-list li {
  padding: 12px 16px;
  background: white;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  color: #333;
  position: relative;
  overflow: hidden;
}

.faq-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: #2196f3;
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.faq-list li:hover {
  background: #f8f9fa;
  border-color: #2196f3;
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.1);
}

.faq-list li:hover::before {
  transform: scaleY(1);
}

.faq-list li:last-child {
  margin-bottom: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .faq-list li {
    padding: 10px 12px;
    font-size: 13px;
  }
}
</style>
